#ifndef CHATWINDOW_H
#define CHATWINDOW_H

#include <QtGui/QDialog>
#include <QWidget>
#include "clientHandler.h"


namespace Ui {
    class ChatWindow;
}

/*! \brief ChatWindow:
   A class that displays a UI that is used to send and
   display messages to another user.
   */
class ChatWindow : public QDialog {
    Q_OBJECT

public:

    /*! ChatWindow
   \brief  A constructor for Login
  */
    ChatWindow(QWidget *parent = 0);

    /*! ~ChatWindow
   \brief   A deconstructor for Login
  */
    ~ChatWindow();

    /*! \var QString nameOfContact
   \brief  The name of the user client is chatting with.
  */
    QString nameOfContact;  // used to make sure we read from the right person

    /*!  \var QString nameOfUser
   \brief  The user name of client.
  */
    QString nameOfUser;

protected:
    /*! ChangeEvent
   \brief  Use to receive the state being changed
   \para
  */
    void changeEvent(QEvent *e);

    /*! keyPressEvent
   \brief  When enter is pressed in Login UI,
   the Login information is sent.
   \para *event
  */
    void keyPressEvent(QKeyEvent *event);

    /*! closeEvent
   \brief  When the ChatWindow UI is terminated,
   event is triggered.
   \para *event
  */
    void closeEvent(QCloseEvent *closed);



private slots:
    /*! on_textEdit_textChanged
   \brief  Enables the send button, if text is entered in
  textEdit
  */
    void on_textEdit_textChanged();

    /*! setMessage
   \brief load ClientHandler instance with message information,
   then send out to server.
  */
    void setMessage();

    /*! displayMessages
   \brief  Handles incoming messages to be displayed
  */
    void displayMessage();


private:
    Ui::ChatWindow *m_ui;

};

#endif // CHATWINDOW_H
